import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { HornEquipmentVO, HornLoginVO, HornEquipmentForm, HornEquipmentQuery } from '@/api/tearoom/hornEquipment/types';

/**
 * 查询喇叭设备管理列表
 * @param query
 * @returns {*}
 */

export const listHornEquipment = (query?: HornEquipmentQuery): AxiosPromise<HornEquipmentVO[]> => {
  return request({
    url: '/tearoom/hornEquipment/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询喇叭设备管理详细
 * @param id
 */
export const getHornEquipment = (id: string | number): AxiosPromise<HornEquipmentVO> => {
  return request({
    url: '/tearoom/hornEquipment/' + id,
    method: 'get'
  });
};

export const getHornLogin = (id: string | number): AxiosPromise<HornLoginVO> => {
  return request({
    url: '/tearoom/hornLogin/' + id,
    method: 'get'
  });
};
/**
 * 新增喇叭设备管理
 * @param data
 */
export const addHornEquipment = (data: HornEquipmentForm) => {
  return request({
    url: '/tearoom/hornEquipment',
    method: 'post',
    data: data
  });
};

/**
 * 修改喇叭设备管理
 * @param data
 */
export const updateHornEquipment = (data: HornEquipmentForm) => {
  return request({
    url: '/tearoom/hornEquipment',
    method: 'put',
    data: data
  });
};
export const idlyBroadcast = (data: HornEquipmentForm) => {
  return request({
    url: '/tearoom/hornEquipment/idlyBroadcast',
    method: 'post',
    data: data
  });
};
/**
 * 删除喇叭设备管理
 * @param id
 */
export const delHornEquipment = (id: string | number | Array<string | number>) => {
  return request({
    url: '/tearoom/hornEquipment/' + id,
    method: 'delete'
  });
};
